package com.five.monkey.feign.consumer.controller;

import com.five.monkey.feign.consumer.client.TestFeignClient;
import com.five.monkey.vo.CommonVo;
import com.five.monkey.vo.TestVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 狻猊
 * @date 2021/8/9 下午3:13
 */
@RestController
@RequestMapping("/consumer/test")
public class ConsumerTestController {

    @Autowired
    private TestFeignClient testFeignClient;

    @GetMapping("/get")
    public CommonVo<TestVo> testGet(@RequestParam("name") String name, @RequestParam("age") int age,
                                    @RequestParam(value = "score", required = false, defaultValue = "0.0f") float score) {
        return testFeignClient.testGet(name, age, score);
    }

    @PostMapping("/post")
    public CommonVo<TestVo> testPost(@RequestBody TestVo testVo) {
        return testFeignClient.testPost(testVo);
    }
}
